import instance from './request'

// 获取轮播图
export const reqGetLunbo = () => {
  return instance({
    url: '/api/getlunbo',
  })
}

// 获取轮播图
export const reqRecommendGoods = (page = 1, pagesize = 10) => {
  return instance({
    url: `/api/recommend?page=${page}&limit=${pagesize}`,
  })
}

// 获取商品分类
export const reqCategory = () => {
  return instance({
    url: `/api/getcategory`,
  })
}

// 获取分类下面的商品
export const reqCategoryGoods = (category_id) => {
  return instance({
    url: `/api/getcategorygoods?category_id=${category_id}`,
  })
}

// 获取搜索商品
export const reqSearchGoods = ({ value, sort, page = 1, pagesize = 10 }) => {
  return instance({
    url: `/api/search`,
    params: { value, sort, page, pagesize },
  })
}

// 获取新闻列表
export const reqNewsList = ({ page = 1, pagesize = 10 }) => {
  return instance({
    url: `/api/getnewslist`,
    params: { page, pagesize },
  })
}

// 获取商品轮播图数据
export const reqGoodsThumbImage = (id) => {
  return instance({
    url: `/api/getthumbimages/${id}`,
  })
}

// 获取商品的基本信息
export const reqGoodsInfo = (id) => {
  return instance({
    url: `/api/getgoodsinfo/${id}`,
  })
}
